<!--conf
<sample>
              <product version="1.4" edition="pro"/>
                     <modifications>
                            <modified date="070101"/>
                     </modifications>
               </sample>
 --> 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
	<title>Extended drag-n-drop</title>
	


</head>
<style>
	
.dragAccessD{
	background-image:url(../../codebase/imgs/false.gif);
	width:22px;
	height:22px;
}
.dragAccessA
{
	width:22px;
	height:22px;
	background-image:url(../../codebase/imgs/true.gif);
}

</style>
<body onload="buildGrid()">
<link rel='STYLESHEET' type='text/css' href='../common/style.css'>
<table cellspacing="0" cellpadding="0" class="sample_header" border="0">
	<tr valign="middle">
		<!-- COMPONENT ICON -->
		<td width="40" align="center"><img src="../common/dhtmlxgrid_icon.gif" border="0"></td>
		<!-- COMPONENT NAME -->
		<td width="150" align="left" nowrap="true">Sample: dhtmlxGrid</td>
		<!-- SAMPLE TITLE -->
		<td width="0" align="left" nowrap><b>Extended drag-n-drop</b></td>
		<!-- LINK TO COMPONENT PAGE -->
		<td width="0" align="right"><a href="http://www.dhtmlx.com/docs/products/dhtmlxGrid/index.shtml">dhtmlxGrid main page</a></td>
		<!-- CLOSE BUTTON -->
		<td width="50"><div class="sample_close"><a href="javascript:void(0);" onclick="self.close();"><img src="../common/sample_close.gif" width="14" height="14" border="0" alt="X"></a></div></td>
	</tr>
</table>
	
	
	<p>Try to move rows from one grid to another and you wiil see special signs with the cursor:
	<li>allowed/denied drag-and-drop</li>
	<li>how many rows (top nodes for treegrid) you are dragging </li>
	<br/>
	Extended drag-n-drop can be set by including dhtmlx_extdrag.js</p>
	
	
	<link rel="STYLESHEET" type="text/css" href="../../codebase/dhtmlxgrid.css">
	<link rel="STYLESHEET" type="text/css" href="../../codebase/ext/dhtmlx_extdrag.css">
	<script  src="../../codebase/dhtmlxcommon.js"></script>
	<script  src="../../codebase/dhtmlxgrid.js"></script>
	<script  src="../../codebase/ext/dhtmlxgrid_splt.js"></script>
	<script  src="../../codebase/ext/dhtmlxgrid_drag.js"></script>
	<script  src="../../codebase/dhtmlxgridcell.js"></script>
	<script  src="../../../dhtmlxTreeGrid/codebase/dhtmlxtreegrid.js"></script>
	<script  src="../../codebase/ext/dhtmlxgrid_math.js"></script>
	<script  src="../../codebase/ext/dhtmlx_extdrag.js" type="text/javascript"></script>
 	
	<table width="100%">
		<tr>
			<td valign="top">
				<div id="gridbox" width="400" height="150px" style="background-color:white;"></div>
			</td>
           <td width="30"></td>
			<td valign="top">
				<div id="gridbox1" width="400" height="150px" style="background-color:white;"></div>
			</td>
           
		</tr>
		<tr>
			<td valign="top">
				<input type='checkbox' checked="checked" id='a22' onclick='mygrid.enableMercyDrag(this.checked)';> Allow mercy drag-and-drop
			</td>
           <td width="30"></td>
			<td valign="top">
				<input type='checkbox' checked="checked" id='a22' onclick='mygrid1.enableMercyDrag(this.checked)';> Allow mercy drag-and-drop
			</td>
           
		</tr>
	</table>

   <div class='sample_code'><div class="hl-main"><pre><span class="hl-code"> 
   
   </span><span class="hl-brackets">&lt;</span><span class="hl-reserved">script</span><span class="hl-code">  </span><span class="hl-var">src</span><span class="hl-code">=</span><span class="hl-quotes">&quot;</span><span class="hl-string">../../codebase/ext/dhtmlx_extdrag.js</span><span class="hl-quotes">&quot;</span><span class="hl-code"> </span><span class="hl-var">type</span><span class="hl-code">=</span><span class="hl-quotes">&quot;</span><span class="hl-string">text/javascript</span><span class="hl-quotes">&quot;</span><span class="hl-brackets">&gt;</span><span class="hl-brackets">&lt;/</span><span class="hl-reserved">script</span><span class="hl-brackets">&gt;</span><span class="hl-code">
   ...
   </span><span class="hl-brackets">&lt;</span><span class="hl-reserved">script</span><span class="hl-brackets">&gt;</span><span class="hl-code"><div class="hl-main"><pre><span class="hl-code"> 
       </span><span class="hl-identifier">mygrid</span><span class="hl-code"> = </span><span class="hl-reserved">new</span><span class="hl-code"> </span><span class="hl-identifier">dhtmlXGridObject</span><span class="hl-brackets">(</span><span class="hl-quotes">'</span><span class="hl-string">gridbox</span><span class="hl-quotes">'</span><span class="hl-brackets">)</span><span class="hl-code">;
    ...
        </span><span class="hl-identifier">mygrid</span><span class="hl-code">.</span><span class="hl-identifier">enableMercyDrag</span><span class="hl-brackets">(</span><span class="hl-reserved">true</span><span class="hl-brackets">)</span><span class="hl-code">;
       </span><span class="hl-identifier">mygrid</span><span class="hl-code">.</span><span class="hl-identifier">enableDragAndDrop</span><span class="hl-brackets">(</span><span class="hl-reserved">true</span><span class="hl-brackets">)</span><span class="hl-code">;
    </span><span class="hl-identifier">mygrid</span><span class="hl-code">.</span><span class="hl-identifier">enableMultiselect</span><span class="hl-brackets">(</span><span class="hl-reserved">true</span><span class="hl-brackets">)</span><span class="hl-code">
    
    </span><span class="hl-identifier">mygrid</span><span class="hl-code">.</span><span class="hl-identifier">init</span><span class="hl-brackets">(</span><span class="hl-brackets">)</span><span class="hl-code">;
    </span><span class="hl-identifier">mygrid</span><span class="hl-code">.</span><span class="hl-identifier">loadXML</span><span class="hl-brackets">(</span><span class="hl-quotes">&quot;</span><span class="hl-string">grid.xml</span><span class="hl-quotes">&quot;</span><span class="hl-brackets">)</span><span class="hl-code">;
    
    </span><span class="hl-identifier">mygrid1</span><span class="hl-code"> = </span><span class="hl-reserved">new</span><span class="hl-code"> </span><span class="hl-identifier">dhtmlXGridObject</span><span class="hl-brackets">(</span><span class="hl-quotes">'</span><span class="hl-string">gridbox1</span><span class="hl-quotes">'</span><span class="hl-brackets">)</span><span class="hl-code">;
    ...
        </span><span class="hl-identifier">mygrid1</span><span class="hl-code">.</span><span class="hl-identifier">enableMercyDrag</span><span class="hl-brackets">(</span><span class="hl-reserved">true</span><span class="hl-brackets">)</span><span class="hl-code">;
    </span><span class="hl-identifier">mygrid1</span><span class="hl-code">.</span><span class="hl-identifier">enableMultiselect</span><span class="hl-brackets">(</span><span class="hl-reserved">true</span><span class="hl-brackets">)</span><span class="hl-code">
    </span><span class="hl-identifier">mygrid1</span><span class="hl-code">.</span><span class="hl-identifier">enableDragAndDrop</span><span class="hl-brackets">(</span><span class="hl-reserved">true</span><span class="hl-brackets">)</span><span class="hl-code">;
    
    </span><span class="hl-identifier">mygrid1</span><span class="hl-code">.</span><span class="hl-identifier">init</span><span class="hl-brackets">(</span><span class="hl-brackets">)</span><span class="hl-code">;
    </span><span class="hl-identifier">mygrid1</span><span class="hl-code">.</span><span class="hl-identifier">loadXML</span><span class="hl-brackets">(</span><span class="hl-quotes">&quot;</span><span class="hl-string">treegrid_sample.xml</span><span class="hl-quotes">&quot;</span><span class="hl-brackets">)</span><span class="hl-code">;</span></pre></div></span><span class="hl-brackets">&lt;/</span><span class="hl-reserved">script</span><span class="hl-brackets">&gt;</span></pre></div></div>



<script>

  function buildGrid(){
  	mygrid = new dhtmlXGridObject('gridbox');
	mygrid.imgURL="../../codebase/imgs/";
	
	mygrid.setHeader("Tree,Plain Text,Long Text,Color,Checkbox");
	mygrid.setInitWidths("150,100,100,100,100")
	mygrid.setColAlign("left,left,left,left,center")
	mygrid.setColTypes("ed,ed,txt,ch,ch");
	mygrid.setColSorting("str,str,str,na,str")
    mygrid.enableMercyDrag(true);
   	mygrid.enableDragAndDrop(true);
	mygrid.enableMultiselect(true)
	mygrid.init();
	mygrid.loadXML("grid.xml");
	
	mygrid1 = new dhtmlXGridObject('gridbox1');
	mygrid1.imgURL="../../codebase/imgs/";
	mygrid1.setHeader("Title,Price,Quantity,Total");
    mygrid1.setInitWidths("150,75,60,100")
    mygrid1.setColAlign("left,right,right,right")
    mygrid1.setColTypes("tree,price,ed[=sum],price[=sum]");
    mygrid1.setColSorting("str,int,int,int")
    mygrid1.setColumnColor("#d5f1ff")
    mygrid1.enableMercyDrag(true);
	mygrid1.enableMultiselect(true)
	mygrid1.setMathRound(2);
	
   	mygrid1.init();
	mygrid1.enableSmartXMLParsing(false);
    mygrid1.enableDragAndDrop(true);
	mygrid1.loadXML("treegrid_sample.xml");

}
	
   

</script>

<!-- FOOTER -->
<table callspacing="0" cellpadding="0" border="0" class="sample_footer"><tr><td style="padding-left: 8px;">&copy; <a href="http://www.dhtmlx.com">DHTMLX LTD</a>. All rights reserved</td></tr></table>
<!-- FOOTER -->

</body>
</html>
